Skip to content

Update swagger-ui to v5.31.0#1254

Merged
chrislearn merged 1 commit intosalvo-rs:mainfrom
tyreseluo:update_swagger_ui_version
Dec 25, 2025
Merged

Update swagger-ui to v5.31.0#1254
chrislearn merged 1 commit intosalvo-rs:mainfrom
tyreseluo:update_swagger_ui_version

Conversation

@tyreseluo
Copy link
Member

@tyreseluo tyreseluo commented Dec 25, 2025

PR content

Update swagger-ui v5.29.0 to v5.31.0

Notes

Swagger now enforces stricter requirements for responses fields. Consequently, when generating related *.json files, an empty response will prevent proper display in the Response UI section.

Each operation must have at least one response defined, usually a successful response. (see: https://swagger.io/docs/specification/v3_0/describing-responses)

Before:

#[endpoint(
    tags("Posts"),
    summary = "get all posts",
    description = "the objective of this endpoint is to retreive all posts",
)]
fn get_all_posts(res: &mut Response){
    res.render("get all posts")
}
image

After

#[endpoint(
    tags("Posts"),
    summary = "get all posts",
    description = "the objective of this endpoint is to retreive all posts",
    responses(
        (status_code = 200, description = "Ok"),
        (status_code = 400, description = "Bad Request"),
    )
)]
fn get_all_posts(res: &mut Response){
    res.render("get all posts")
}
image

Related PR or Issue

@chrislearn chrislearn marked this pull request as ready for review December 25, 2025 03:20
@chrislearn chrislearn merged commit 71a1894 into salvo-rs:main Dec 25, 2025
7 checks passed
@tyreseluo
Copy link
Member Author

Search Keywords Mark:

  • Swagger UI: Why Responses section not displaying/working?

@tyreseluo tyreseluo deleted the update_swagger_ui_version branch December 26, 2025 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants